home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 37 / Amiga Format CD37 (1999-02-16)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-03].iso / -readerstuff- / paul_thompson / source / amos-source / installer.amos / installer.amosSourceCode < prev    next >
AMOS Source Code  |  1999-01-06  |  13KB  |  409 lines

  1. ' ****************************************** 
  2. ' *                                        * 
  3. ' *               Tutankhamun              *   
  4. ' *                                        * 
  5. ' *         Hard Disk Installer V1.0       * 
  6. ' *                                        * 
  7. ' ****************************************** 
  8. '
  9. ' Screen Open 0,640,256,8,Hires
  10. ' Flash Off  
  11. ' Load Iff "dh1:tempory/install" 
  12. ' Wait Vbl : Palette $0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$0,$EED,$D44,$0 
  13. ' Wait Vbl : Spack 0 To 5 : Boom : Edit  
  14. ' Palette $269 : Colour Back $269 : Screen Display Screen,,,,
  15.  
  16. Close Workbench 
  17. Break Off 
  18. Screen Open 0,640,256,16,Hires
  19. Curs Off : Flash Off : Cls 0
  20. Unpack 5 To 0
  21. Ink 11 : Bar 14,234 To 623,247
  22.   Colour Back $0 : Screen Display 0,,,,
  23.  
  24. Fade 1,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$FFF,$0
  25. For N=1 To 25 : C1=Colour(0) : Colour Back C1 : Screen Display 0,,,, : Wait Vbl : Next 
  26. Fade 2,$0,$FFF,$FD,$AA,$88,$44,$FFF,$0
  27. For N=1 To 30 : C1=Colour(0) : Colour Back C1 : Screen Display 0,,,, : Wait Vbl : Next 
  28.  
  29. Limit Mouse 128,42 To 447,297
  30. Pen 1 : Paper 0 : For N=1 To 6 : Make Icon Mask N : Next 
  31. Wind Open 1,0,19,78,23,0 : Curs Off : Clw 
  32.  
  33. D$="Sys:" : Dir$=D$
  34. Dim A$(10) : Dim A(10) : Dim B(10) : Dim C(10) : Dim D(10)
  35. Global D$,A(),B(),C(),D(),X,F$,A$,VOL$,CLICK,BLANK,TIME,DELAY
  36. Global FILE1$,FILE2$,FILE3$,MU,TRACK,VOL,FIL,PAL,BRIGHT
  37. Global C0,C1,C2,C3,C4,C5,C6,C7
  38.  
  39. Reserve Zone 8
  40. For N=1 To 6 : Read A(N),B(N),C(N),D(N) : Set Zone N,A(N),B(N) To C(N),D(N) : Next 
  41. Data 0,0,31,16,13,211,94,227,105,211,194,227
  42. Data 257,211,381,227,445,211,535,227,543,211,624,227
  43.  
  44. ST:
  45. Do 
  46.     X=Mouse Zone : Y=Mouse Click
  47.     If X>0 and X<7 and Y=1 Then ICON
  48.     If X=1 and Y=1 or X=6 and Y=1 Then QUIT
  49.     If X=2 and Y=1 Then Clw : INSTALL
  50.     If X=3 and Y=1 Then Clw : MAKE_DIR
  51.     If X=4 and Y=1 Then Clw : HOW
  52.     If X=5 and Y=1 Then ABOUT
  53. Loop 
  54.  
  55. Procedure ABOUT
  56. Auto View Off 
  57.   C=Chip Free : D=Fast Free : C$=Str$(C+D)
  58. Get Block 1,158,43,336,137,0
  59. Cls 3,160,43 To 479,179
  60.  
  61. Ink 5
  62. For N=1 To 12 : Read A,B,C,D : If N>6 Then Ink 5 Else Ink 2
  63. Draw A,B To C,D : Next 
  64.  Extension_12_0394 160,44,1 : Extension_12_0394 161,44,1
  65.  
  66. Data 158,43,478,43
  67. Data 158,43,158,179
  68. Data 159,44,159,179
  69. Data 173,82,173,152
  70. Data 174,82,174,152
  71. Data 174,152,461,152
  72. Data 477,44,477,179
  73. Data 478,43,478,179
  74. Data 159,179,476,179
  75. Data 174,82,462,82
  76. Data 461,82,461,152
  77. Data 462,82,462,152
  78.  
  79.  
  80. ' Data 477,43,477,179
  81. ' Data 478,43,478,179
  82.  
  83.  
  84.    Cls 4,175,83 To 461,152
  85.  
  86. Paste Icon 172,56,3 : Paste Icon 353,56,4 : Paste Icon 280,158,5
  87. Set Font 0 : Gr Writing 0
  88.  
  89.       For N=1 To 6 : Read B$ : Ink 5 : Text 184,85+10*N,B$ : Ink 1 : Text 186,85+10*N-1,B$ : Next 
  90.       Ink 1,3 : Set Font F1 : Gr Writing 1
  91.  
  92.       ' For N=1 To 6 : Read B$ : Ink 5 : Text 182,105+10*N,B$ : Ink 1 : Text 184,105+10*N-1,B$ : Next  
  93.       ' Ink 1,3 : Set Font F1 : Gr Writing 1 : Text 300,188,"Exit" 
  94.  
  95. Data "PROGRAM   :  TITANIC II INSTALLER"
  96. Data "RELEASE   :  V1.00 - 5 APRIL 1995"
  97. Data "CODED BY  :  PAUL THOMPSON"
  98. Data "ADDRESS   :  7 QUEENS RD, FORMBY"
  99. Data "          :  MERSEYSIDE, L37 2HF"
  100. Data "MEMORY    : "+C$+" BYTES FREE"
  101.  
  102. Colour 20,$FD : Colour 21,$99 : Colour 23,$44
  103. Sprite 1,268,90,1
  104. Amal 1,"A 0,(1,3)(2,3)(3,3)(4,3)(5,3)(6,3)(7,3)(8,3)(9,3)"
  105. Amal On 1 : Auto View On : View 
  106.  
  107. Set Zone 7,280,158 To 356,174
  108. A(7)=280 : B(7)=158 : C(7)=356 : D(7)=174
  109. Do 
  110.    Y=Mouse Click : X=Mouse Zone
  111.    If Y=1 and X=7 Then ICON
  112.    If Y=1 and X=7 Then Sprite Off : Amal Off : Wait Vbl : Put Block 1,, : Del Block 1 : Pop Proc
  113.    Multi Wait 
  114. Loop 
  115. End Proc
  116. Procedure QUIT
  117. Get Block 1,138,60,368,132,0
  118. Cls 0,225,85 To 245,95
  119. Paste Icon 218,75,6
  120.  
  121. Set Zone 7,235,121 To 311,137
  122. Set Zone 8,327,121 To 403,137
  123.    A(7)=235 : B(7)=121 : C(7)=311 : D(7)=137
  124.    A(8)=327 : B(8)=121 : C(8)=403 : D(8)=137
  125. Do 
  126.    Y=Mouse Click : X=Mouse Zone
  127.    If Y=1 and X=7 or Y=1 and X=8 Then ICON
  128.    If Y=1 and X=7 Then Put Block 1,, : Del Block 1 : Pop Proc
  129.    If Y=1 and X=8 Then Put Block 1,, : Del Block 1 : Edit 
  130.    Multi Wait 
  131. Loop 
  132. End Proc
  133. Procedure ICON
  134.      Gr Writing 3
  135.      Bar A(X),B(X) To C(X)-1,D(X)-1
  136.      Wait 2
  137.      E=X : F=1
  138. Repeat 
  139. X=Mouse Zone
  140. If X<>E and F=1 Then Bar A(E),B(E) To C(E)-1,D(E)-1 : F=0
  141. If X=E and F=0 Then Bar A(E),B(E) To C(E)-1,D(E)-1 : F=1
  142. Multi Wait 
  143. Until Mouse Key=0
  144.         If X=E Then Bar A(E),B(E) To C(E)-1,D(E)-1
  145.         Wait 2
  146.         Gr Writing 1
  147.         If X<>E Then X=0
  148. End Proc
  149. Procedure INSTALL
  150. On Error Proc HELP
  151. Resume Label ST
  152.      BR=1
  153.      F$=Fsel$(Dir$," ","Select Directory To","Install Titanic II")
  154.      If F$="" Then Print "Operation Cancelled" : Pop Proc
  155.      If Dfree<1800000 Then MESS2 : Pop Proc
  156.      VOL$="Titanic1:" : Ink 11 : Bar 14,234 To 623,247
  157.      DK1
  158.         Print "Installing Titanic II To "+Dir$ : Print 
  159.         Print "Loading Titanic1:S/TitanicII.Prefs"
  160.         PREF_LOAD
  161.         FILE1$=Dir$+"Music/" : FILE2$=Dir$+"Pics/" : FILE3$=Dir$+"Data/"
  162.         Print "Saving Sys:S/TitanicII.Prefs"
  163.         PREF_SAVE
  164.    For N=1 To 43
  165.           If N<12 Then BR=BR+27
  166.           If N>11 and N<43 Then BR=BR+10
  167.           If N=43 Then BR=BR+1
  168.           If N=14 Then VOL$="Titanic2:" : DK2
  169.           If N=1 Then B$=Dir$ : Dir$="Sys:"
  170.           If N=1 Then FONT_TEST : Mkdir "Sys:Fonts/Titanic" : Mkdir "Sys:Fonts/NewTopaz"
  171.           If N=6 Then Dir$=B$
  172.           If N=6 and Exist(Dir$+"Data") Then Print "Directory "+Dir$+"Data Already Exists" : Goto BREAK1
  173.           If N=6 Then Print "Making New Directory "+Dir$+"Data" : Mkdir Dir$+"Data"
  174.           If N=9 and Exist(Dir$+"Music") Then Print "Directory "+Dir$+"Music Already Exists" : Goto BREAK1
  175.           If N=9 Then Print "Making New Directory "+Dir$+"Music" : Mkdir Dir$+"Music"
  176.           If N=14 and Exist(Dir$+"Pics") Then Print "Directory "+Dir$+"Pics Already Exists" : Goto BREAK1
  177.           If N=14 Then Print "Making New Directory "+Dir$+"Pics" : Mkdir Dir$+"Pics"
  178.         BREAK1:
  179.           Read A$,LE
  180.           If Exist(Dir$+A$) Then Print "File "+Dir$+A$+" Already Exists" : Goto BREAK2
  181.           Reserve As Work 6,LE
  182.           Print "Loading "+VOL$+A$
  183.           Bload VOL$+A$,6
  184.           Print "Saving "+Dir$+A$
  185.           Bsave Dir$+A$,Start(6) To Start(6)+Length(6)
  186.         BREAK2:
  187.           Ink 4 : Bar 14,234 To 14+BR,247
  188.           Erase 6
  189.           ST:
  190.    Next N
  191.           Print : Print "Titanic II Installation Complete"
  192.           Print "You will find Titanic II in the Directory "+Dir$
  193.           CHECK=0
  194. Data "Fonts/Titanic.font",524,"Fonts/Titanic/8",1980,"Fonts/Titanic/11",2260
  195. Data "Fonts/NewTopaz.font",264,"Fonts/NewTopaz/8",3332
  196. Data "TitanicII",224340,"TitanicII.info",1598
  197. Data "Data/TitanicII.Data",99526
  198.  
  199. Data "Music/Laidback",47216,"Music/Mellow",40754
  200. Data "Music/PianoSong",35828,"Music/Sleep",41200
  201. Data "Music/Village",47936
  202.  
  203. Data "Pics/Art1",41596,"Pics/Art2",35854,"Pics/Art3",42426
  204. Data "Pics/Art4",39914,"Pics/Art5",43440,"Pics/Art6",39760
  205. Data "Pics/Art7",45554
  206.  
  207. Data "Pics/Enter1",27072,"Pics/Enter2",27974,"Pics/Enter3",21414
  208. Data "Pics/Enter4",26026,"Pics/Enter5",24162
  209.  
  210. Data "Pics/Interior1",27472,"Pics/Interior2",29968,"Pics/Interior3",28554
  211. Data "Pics/Interior4",30402,"Pics/Interior5",27110
  212.  
  213. Data "Pics/Lifeboat1",28978,"Pics/Lifeboat2",28770,"Pics/Lifeboat3",27900
  214. Data "Pics/Lifeboat4",27896,"Pics/Lifeboat5",27236
  215.  
  216. Data "Pics/Titanic1",27358,"Pics/Titanic2",18022,"Pics/Titanic3",24300
  217. Data "Pics/Titanic4",17204,"Pics/Titanic5",21526,"Pics/Titanic6",18438
  218. Data "Pics/Titanic7",17900,"Pics/Titanic8",27116
  219. End Proc
  220. Procedure MAKE_DIR
  221. On Error Proc HELP
  222. Resume Label ST
  223.    F$=Fsel$(Dir$,"TitanicII","Select Name & Posistion","Of New Directory")
  224.    If F$="" Then Print "Operation Cancelled" : Pop Proc
  225.    Mkdir F$ : Bsave F$+".info",Start(10) To Start(10)+Length(10)
  226.    Dir$=F$+"/"
  227. ST:
  228. End Proc
  229. Procedure DK1
  230. If Exist("Titanic1:") Then Pop Proc
  231. Get Block 1,128,97,384,29,0
  232. Cls 3,128,97 To 510,125
  233. Ink 2
  234.      Draw 128,97 To 510,97
  235.      Draw 510,97 To 510,125
  236.      Draw 509,97 To 509,125
  237. Ink 5
  238.      Draw 128,97 To 128,125
  239.      Draw 129,98 To 129,125
  240.      Draw 128,125 To 509,125
  241.       Extension_12_0394 130,98,1 : Extension_12_0394 131,98,1
  242.      Ink 1,3 : Extension_18_0A8A 113,"Please Insert Titanic Disk 1"
  243.  
  244. Do 
  245.      If Exist("Titanic1:") Then Put Block 1,, : Del Block 1 : Pop Proc
  246.      Multi Wait 
  247. Loop 
  248. End Proc
  249. Procedure HOW
  250. Centre "INSTRUCTIONS"
  251. Print : Print 
  252. Print "Welcome to the Titanic II installer. To Install Titanic II you must first"
  253. Print "Boot from your Hard Disk, then click on the install button at the bottom of"
  254. Print "the screen, this will then bring up a File Requestor for you to select the"
  255. Print "directory in which to install Titanic II, installation is then automatic."
  256. Print : 
  257. Print "Other Buttons Explained."
  258. Print 
  259. Print "MAKE DIR: This  button allows you to create new directory, a File Requester"
  260. Print "will ask for the name and location of the directory."
  261. Print 
  262. Print "INSTRUCTIONS: Brings up this text."
  263. Print 
  264. Print "ABOUT: Gives information about the installer program, such as release date,"
  265. Print "version number, author, etc."
  266. Print 
  267. Print "QUIT: Allows you to exit the installer program."
  268. Print 
  269. Print "Please note, the installer saves out a file to your Sys:S/ directory called"
  270. Print "TitanicII.prefs, the file contains the location of the Pics, Music and Data"
  271. Print "directorys for the Titanic II program and should not be altered in any way."
  272. End Proc
  273. Procedure HELP
  274. N=0
  275. If Errn=89 Then Print "File is protected against deletion!" : Inc N
  276. If Errn=91 Then Print "File is protected against reading!" : Inc N
  277. If Errn=142 Then Print "Device cannot be opened!" : Inc N
  278. If Errn=144 Then Print "Device Error!" : Inc N
  279. If Errn=86 Then Print "Device not availiable!" : Inc N
  280. If Errn=80 Then Print "Directory not found!" : Inc N
  281. If Errn=101 Then Print "Disc Error!" : Inc N
  282. If Errn=88 Then Print "Disc full!" : Inc N
  283. If Errn=83 Then Print "Disk is not validated!" : Inc N
  284. If Errn=84 Then Print "Disc is write protected!" : Inc N
  285. If Errn=81 Then Print "File not found!" : Inc N
  286. If Errn=79 Then Print "File already exists!" : Inc N
  287. If Errn=94 Then Print "I/O Error!" : Inc N
  288. If Errn=90 Then Print "File is write protected!" : Inc N
  289. If N=0 Then Print "There has been an Error!" : Inc N
  290. Resume Label 
  291. End Proc
  292. Procedure MESS2
  293. Get Block 1,188,70,260,83,0
  294. Cls 3,188,70 To 450,152
  295. FR$=Str$(Dfree)
  296. Ink 2
  297.      Draw 188,70 To 450,70
  298.      Draw 188,70 To 188,152
  299.      Draw 189,71 To 189,152
  300. Ink 5
  301.      Draw 450,70 To 450,152
  302.      Draw 449,71 To 449,152
  303.      Draw 189,152 To 449,152
  304.  Extension_12_0394 190,71,1 : Extension_12_0394 191,71,1
  305.  
  306. Ink 1,4 : Paste Icon 280,132,5
  307.  
  308. Gr Writing 0
  309. For N=1 To 6 : Read C$
  310.    L=Text Length(C$)
  311.    Ink 1 : Text 320-L/2,74+N*8,C$
  312. Next 
  313.  
  314. Data "ERROR!!!",
  315. Data "Not Enough Disk Space",
  316. Data "Disk Space Free   :"+FR$
  317. Data "Disk Space needed : 1800000"
  318.  
  319. Gr Writing 1
  320. Set Zone 7,280,132 To 358,148
  321. A(7)=280 : B(7)=132 : C(7)=358 : D(7)=148
  322.   Do 
  323.      X=Mouse Zone : Y=Mouse Key
  324.      If X=7 and Y=1 Then ICON
  325.      If X=7 and Y=1 Then Put Block 1,, : Del Block 1 : Pop Proc
  326.   Loop 
  327. End Proc
  328. Procedure DK2
  329. If Exist("Titanic2:") Then Pop Proc
  330. Get Block 1,128,97,384,29,0
  331. Cls 3,128,97 To 510,125
  332. Ink 2
  333.      Draw 128,97 To 510,97
  334.      Draw 510,97 To 510,125
  335.      Draw 509,97 To 509,125
  336. Ink 5
  337.      Draw 128,97 To 128,125
  338.      Draw 129,98 To 129,125
  339.      Draw 128,125 To 509,125
  340.       Extension_12_0394 130,98,1 : Extension_12_0394 131,98,1
  341.      Ink 1,3 : Extension_18_0A8A 113,"Please Insert Titanic Disk 2"
  342.  
  343. Do 
  344.      If Exist("Titanic2:") Then Put Block 1,, : Del Block 1 : Pop Proc
  345.      Multi Wait 
  346. Loop 
  347. End Proc
  348. Procedure FONT_TEST
  349. If Exist("Sys:Fonts/NewTopaz/8") Then Kill "Sys:Fonts/NewTopaz/8"
  350. If Exist("Sys:Fonts/NewTopaz") Then Kill "Sys:Fonts/NewTopaz"
  351. If Exist("Sys:Fonts/NewTopaz.font") Then Kill "Sys:Fonts/NewTopaz.font"
  352.  
  353. If Exist("Sys:Fonts/Titanic/8") Then Kill "Sys:Fonts/Titanic/8"
  354. If Exist("Sys:Fonts/Titanic/11") Then Kill "Sys:Fonts/Titanic/11"
  355. If Exist("Sys:Fonts/Titanic") Then Kill "Sys:Fonts/Titanic"
  356. If Exist("Sys:Fonts/Titanic.font") Then Kill "Sys:Fonts/Titanic.font"
  357. End Proc
  358. Procedure PREF_SAVE
  359. If Exist("Sys:S/TitanicII.Prefs") Then Kill "Sys:S/TitanicII.Prefs"
  360. Open Out 1,"Sys:S/TitanicII.Prefs"
  361. Print #1,FILE1$
  362. Print #1,FILE2$
  363. Print #1,FILE3$
  364. Print #1,MU
  365. Print #1,TRACK
  366. Print #1,VOL
  367. Print #1,FIL
  368. Print #1,PAL
  369. Print #1,C0
  370. Print #1,C1
  371. Print #1,C2
  372. Print #1,C3
  373. Print #1,C4
  374. Print #1,C5
  375. Print #1,C6
  376. Print #1,C7
  377. Print #1,BRIGHT
  378. Print #1,CLICK
  379. Print #1,BLANK
  380. Print #1,TIME
  381. Print #1,DELAY
  382. Close 1
  383. End Proc
  384. Procedure PREF_LOAD
  385. D$="Titanic1:S/TitanicII.Prefs"
  386. Open In 1,D$
  387. Input #1,FILE1$
  388. Input #1,FILE2$
  389. Input #1,FILE3$
  390. Input #1,MU
  391. Input #1,TRACK
  392. Input #1,VOL
  393. Input #1,FIL
  394. Input #1,PAL
  395. Input #1,C0
  396. Input #1,C1
  397. Input #1,C2
  398. Input #1,C3
  399. Input #1,C4
  400. Input #1,C5
  401. Input #1,C6
  402. Input #1,C7
  403. Input #1,BRIGHT
  404. Input #1,CLICK
  405. Input #1,BLANK
  406. Input #1,TIME
  407. Input #1,DELAY
  408. Close 1
  409. End Proc